package com.utcs.modules.resource.basic.entity;

import com.utcs.common.persistence.DataEntity;
import com.utcs.common.persistence.TreeEntity;

/**
 * Created by Fly on 2017/5/24.
 */
public class Menu extends DataEntity<Menu>{

    private static final long serialVersionUID = 1L;
    private Menu parent;	// 父级菜单
    private String parentIds; // 所有父级编号
    private String name; 	// 名称
    private String href; 	// 链接
    private String target; 	// 目标（ mainFrame、_blank、_self、_parent、_top）
    private String icon; 	// 图标
    private Integer sort; 	// 排序
    private String permission; // 权限标识

    private Integer userId;

    public Menu() {
        super();
        this.sort = 30;
        this.showSign = SHOW_SIGN_VISIBLE;
    }

    public Menu(Integer id) {
        super(id);
    }

    /**
     * jackson中的@JsonBackReference和@JsonManagedReference，以及@JsonIgnore均是为了解决对象中存在双向引用导致的无限递归（infinite recursion）问题。这些标注均可用在属性或对应的get、set方法中
     * @return
     */
    public Menu getParent() {
        return parent;
    }

    /**
     * 父对象，只能通过子类实现，父类实现mybatis无法读取
     * @param parent
     * @return
     */
    public void setParent(Menu parent) {
        this.parent = parent;
    }

    public String getParentIds() {
        return parentIds;
    }

    public void setParentIds(String parentIds) {
        this.parentIds = parentIds;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Override
    public String toString() {
        return "Menu{" +
                "parentIds='" + parentIds + '\'' +
                ", name='" + name + '\'' +
                ", href='" + href + '\'' +
                ", target='" + target + '\'' +
                ", icon='" + icon + '\'' +
                ", sort=" + sort +
                ", permission='" + permission + '\'' +
                '}';
    }
}
